number pattern problems in programming